package com.xgk.boot.framework.common.context;

import java.util.HashMap;
import java.util.Map;

public class ElmOrderThreadContext {
    private static final ThreadLocal<Map<String, Object>> context = ThreadLocal.withInitial(HashMap::new);

    public static void put(String key, Object value) {
        context.get().put(key, value);
    }

    public static void putOrderCode(Object value) {
        context.get().put("orderCode", value);
    }

    public static void removeOrderCode() {
        context.get().remove("orderCode");
    }

    public static Object getOrderCode() {
        return context.get().get("orderCode");
    }

    public static void putRefrenceNo(Object value) {
        context.get().put("refrenceNo", value);
    }
    public static void removefrenceNo() {
        context.get().remove("refrenceNo");
    }

    public static Object getRefrenceNo() {
        return context.get().get("refrenceNo");
    }

    public static Object get(String key) {
        return context.get().get(key);
    }

    public static Map<String, Object> getAll() {
        return context.get();
    }

    public static void setAll(Map<String, Object> map) {
        context.get().putAll(map);
    }

    public static void remove(String key) {
        context.get().remove(key);
    }

    public static void clear() {
        context.remove();
    }
}
